package com.wao.cms.service.mapper;

import com.wao.cms.domain.*;
import com.wao.cms.service.dto.HeaderDTO;

import org.mapstruct.*;

/**
 * Mapper for the entity Header and its DTO HeaderDTO.
 */
@Mapper(componentModel = "spring", uses = {WebsiteMapper.class, })
public interface HeaderMapper extends EntityMapper <HeaderDTO, Header> {

    @Mapping(source = "website.id", target = "websiteId")
    @Mapping(source = "website.name", target = "websiteName")
    HeaderDTO toDto(Header header); 

    @Mapping(source = "websiteId", target = "website")
    Header toEntity(HeaderDTO headerDTO); 
    default Header fromId(Long id) {
        if (id == null) {
            return null;
        }
        Header header = new Header();
        header.setId(id);
        return header;
    }
}
